home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / I-Z / ResExpress 1.0.sea / ResExpress 1.0 / ResX DevKit / Think Pascal / Cursor RXVW.p next >
Text File  |  1990-10-08  |  2KB  |  61 lines

  1. {Cursor RXVW}
  2.  
  3. {This is an example of an RXVW code resource}
  4. {To compile in Think Pascal:}
  5.  
  6. {   1) Set Project Type to 'Code Resource'}
  7. {   2) Set the resource TYPE to 'RXVW'}
  8. {   3) Set the resource NAME to the resource type you are making a view for.}
  9. {        In this example, the resource name must be 'CURS'}
  10. {   4) Add this file, DRVRRuntime.lib, and Interface.lib to the project}
  11. {   5) Compile the code resource.}
  12. {   6) Install it in ResX via the 'Externals->Install' menu.}
  13.  
  14. {A unit of utilities is in the works to give access to ResX internals.  I'm not }
  15. {releasing info on the Globals structure just yet.  This will allow you to}
  16. {have access to the entire ResX environment.}
  17.  
  18.  
  19. unit ShowCursor;
  20.  
  21.  
  22. interface
  23.     procedure main (ResHandle: Handle);  {Handle of the current selected resource}
  24.  
  25.  
  26. implementation
  27.     procedure main;
  28.         var
  29.             crsrHandle: CursHandle;
  30.             rsrID: integer;
  31.             rsrType: ResType;
  32.             rsrName: Str255;
  33.             HState: SignedByte;
  34.  
  35.  
  36.     begin
  37.  
  38.      {For most views, you will only need the handle to the resource but in this case, we need}
  39.      {to know the resource ID. In this example, we do a GetCursor so do not need to load the }
  40.      {resource.}
  41.  
  42.      {This is necessary because GetCursor needs the resource ID but only the Handle is given.}
  43.         GetResInfo(ResHandle, rsrID, rsrType, rsrName);        {Get the resource id of the cursor}
  44.  
  45.         HState := HGetState(ResHandle);       {This is mandatory!}
  46.  
  47.         crsrHandle := GetCursor(rsrID);
  48.         SetCursor(crsrHandle^^);
  49.  
  50.  
  51.         repeat
  52.         until button;
  53.  
  54.         InitCursor;
  55.  
  56.         HSetState(ResHandle, HState);          {This is mandatory!}
  57.      {Do NOT release the resource or dispose the handle, ResX will do it if necessary. }
  58.      {This is critical in case the resource is being used by a currently running application. }
  59.  
  60.     end;
  61. end.